home *** CD-ROM | disk | FTP | other *** search
/ Loadstar 159 / 159.d81 / b.crypto results (.txt) < prev    next >
Encoding:
Commodore BASIC  |  1997-01-01  |  15.7 KB  |  386 lines

  1. 10 rem solving knees calhoon's crypto challenge from loadstar 156
  2. 20 rem tom lawless / 229 dogwood lane / maynardville, tn 37807 / june 1997
  3. 30 poke53771,0:rem 20mhz if supercpu
  4. 40 c$=chr$(147):h$=chr$(19):b$=chr$(31):r$=chr$(28):o$=chr$(18):f$=chr$(146)
  5. 50 d$=chr$(17):u$=chr$(145):l$=chr$(157):i$=chr$(29):a$="":j$="":z$=""
  6. 60 g$=r$+"[184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184][184]"+b$:e$=r$+"[185][185][185][185][185][185][185][185][185][185][185][185][185][185][185][185][185][185][185]"+b$
  7. 70 m$="-------------------":s$=o$+"                   "
  8. 80 n$="-----------   ----------   -----------":print c$chr$(14);
  9. 90 poke 53280,15:poke 53281,15:d=230:dim c(39):for k=1 to 39:c(k)=-1:next
  10. 100 dim i(d),n(d),o(d),t(d),w(d),l(d),v(d),f(d),s(d),x(d),g(d),h(d),r(d),u(d)
  11. 110 :
  12. 120 print r$"[184]"g$g$,b$" 1. [207]+[206]+[197] = 1        [211][207][204][214][201][206][199]"
  13. 130 print m$"  [203][206][197][197][211][160][195][193][204][200][207][207][206]'[211]"
  14. 140 print" 2. [212]+[215]+[207] = 2        [195][210][217][208][212][207][160][195][200][193][204][204][197][206][199][197]",m$i$e$
  15. 150 print" 3. [212]+[200]+[210]+[197]+[197] = 3   "s$,f$m$i$o$" [211]olve this system "
  16. 160 print" 4. [198]+[207]+[213]+[210] = 4     "s$,f$m$i$o$" of equations over "
  17. 170 print" 5. [198]+[201]+[214]+[197] = 5     "s$,f$m$i$o$" the integers from "
  18. 180 print" 6. [211]+[201]+[216] = 6       "s$,f$m$i$o$" -19 to 19, inclu- "
  19. 190 print" 7. [211]+[197]+[214]+[197]+[206] = 7   "s$,f$m$i$o$" sive, with no two "
  20. 200 print" 8. [197]+[201]+[199]+[200]+[212] = 8   "s$,f$m$i$o$" variables having  "
  21. 210 print" 9. [206]+[201]+[206]+[197] = 9     "s$,f$m$i$o$" the same value.   "
  22. 220 print"10. [212]+[197]+[206] = 10      "s$,f$m$i$g$
  23. 230 print"11. [197]+[204]+[197]+[214]+[197]+[206] = 11  "r$"<[195]> [195]ontinue"b$
  24. 240 print m$"-  "r$"<[208]> [208]rint"b$
  25. 250 print"12. [212]+[215]+[197]+[204]+[214]+[197] = 12  "r$"<[212]> [212]ab 40 [208]rint"b$
  26. 260 print e$r$"[185]  <[209]> [209]uit"b$h$:gosub 5000
  27. 270 :
  28. 490 rem method
  29. 500 print c$tab(17)"[205][197][212][200][207][196]":print i$e$e$,i$s$s$,i$;
  30. 510 print" 1. [211]elect value of [197]. ([213]ser input)   ",i$s$s$,i$;
  31. 520 print" 2. [212][193][194][204][197] 1: 1 row for each [201] value.  ",i$;
  32. 530 print"    [197]valuate [206],[207],[212],[215] on each row.     ",i$;
  33. 540 print"    [196]iscard rows w/forbidden values.  ",i$s$s$,i$;
  34. 550 print" 3. [212][193][194][204][197] 2: [213]se all [204] values with    ",i$;
  35. 560 print"    each row of [212][193][194][204][197] 1. [197]valuate     ",i$;
  36. 570 print"    [214],[198],[211],[216]. [196]iscard rows as before.  ",i$s$s$,i$;
  37. 580 print" 4. [212][193][194][204][197] 3: [213]se all [199] values with    ",i$;
  38. 590 print"    each row of [212][193][194][204][197] 2. [197]valuate     ",i$;
  39. 600 print"    [200],[210],[213]. [196]iscard rows as before.    ",i$s$s$,i$;
  40. 610 print" 5. [196]isplay solutions. [210]eturn to 1.   ",i$s$s$,i$f$g$g$
  41. 620 print" [197] ="e;tab(8)"<"r$"+"b$"/"r$"-"b$">[211]elect [207]ne [197] [214]alue   <"r$"[200]"b$">"
  42. 630 print" <"r$"\"b$">[211]olve--[212]his [197]--[215]ork [211]creens   [200]elp"
  43. 640 print" <"r$"^"b$">[211]olve--[212]his [197]--[199]auge [211]creen   -----"
  44. 650 print" <"r$"*"b$">[211]olve--[193]ll [197]'s-[199]auge [211]creen   <[208]/[212]>"
  45. 660 print" <"r$"_"b$">[193]ssume [211]ummary [196]ata--[212]his [197]   <[209]>"u$u$u$u$
  46. 670 poke 650,128
  47. 680 get q$:if q$="q" then 40000
  48. 690 if q$="p"or q$="t"then gosub 9000:goto 680
  49. 695 if q$="h" then gosub 4000:goto 500
  50. 700 if q$="\"then c=0:goto 830
  51. 710 if q$="^"then c=-1:goto 830
  52. 720 if q$="*"then c=1:e=-19:goto 830
  53. 730 if q$<>"_" then 790
  54. 740 poke 53280,3:poke 53281,3
  55. 750 for k=1 to e+20:read z:next:restore
  56. 760 c=0:goto 2200
  57. 770 data 0,0,0,0,0,0,6,22,40,77,51,125,125,151,199,226,103,139,199,142
  58. 780 data 160,92,182,0,122,57,82,125,109,75,63,69,33,18,8,7,1,0,0
  59. 790 if q$<>"+"and q$<>"-"then 680
  60. 800 if q$="+"then e=e+1:if e=20 then e=-19
  61. 810 if q$="-"then e=e-1:if e=-20 then e=19
  62. 820 print tab(4)u$"   "l$l$l$e;b$:goto 680
  63. 830 poke 650,0:if c=0 then 940
  64. 840 if c=-1 then 930
  65. 850 :
  66. 890 rem table 1
  67. 900 if c(e+20)=-1 then 930
  68. 910 if e=19 then poke 53280,7:poke 53281,7:goto 2200
  69. 920 e=e+1:goto 900
  70. 930 print c$d$d$r$tab(9)"[197] ="e,,,d$b$"[212][193][194][204][197] 1: "r$"[201]  [206]  [207]  [212]  [215]"b$:goto 1060
  71. 940 print c$;:gosub 3030
  72. 950 print" 1. [207]+[206] ="1-e:print" 2. [212]+[215]+[207] = 2":print" 3. [212]+[200]+[210] ="3-2*e
  73. 960 print" 4. [198]+[207]+[213]+[210] = 4":print" 5. [198]+[201]+[214] ="5-e:print" 6. [211]+[201]+[216] = 6"
  74. 970 print" 7. [211]+[214]+[206] ="7-2*e:print" 8. [201]+[199]+[200]+[212] ="8-e:print" 9. 2[206]+[201] ="9-e
  75. 980 print"10. [212]+[206] ="10-e:print"11. [204]+[214]+[206] ="11-3*e:print m$l$" "
  76. 990 print" 9. [206] =("9-e"-[201])/2":print" 1. [207] ="1-e"-[206]"
  77. 1000 print"10. [212] ="10-e"-[206]":print" 2. [215] = 2-[212]-[207]"
  78. 1010 print e$l$" ":print o$"[201] _ [206] _ [207] & [212] _ [215] "
  79. 1020 print o$"[213]se all [201] values: ",,,"-19 < = [201] < = +19 ":print g$l$" "
  80. 1030 print h$tab(19)r$"[185][185][185] [185][185][185] [185][185][185] [185][185][185] [185][185][185]"b$,tab(19)
  81. 1040 print o$" [201] "i$" [206] "i$" [207] "i$" [212] "i$" [215] ",tab(19)
  82. 1050 print f$r$"[184][184][184] [184][184][184] [184][184][184] [184][184][184] [184][184][184]"b$,tab(20)"/   /   /   /   /"u$
  83. 1060 z=0:for i=-19 to 19
  84. 1070 n=(9-e-i)/2:if n<-19 or n>19 or n=i or n=e or n<>int(n) then 1120
  85. 1080 o=1-e-n:if o<-19 or o>19 or o=n or o=i or o=e then 1120
  86. 1090 t=10-e-n:if t<-19 or t>19 or t=n or t=i or t=e then 1120
  87. 1100 w=2-t-o:if w<-19 or w>19 or w=n or w=i or w=e then 1120
  88. 1110 z=z+1:i(z)=i:n(z)=n:o(z)=o:t(z)=t:w(z)=w
  89. 1120 next
  90. 1130 if c<>0 then 1200
  91. 1140 for k=1 to z:print tab(19)i(k)tab(23)n(k)tab(27)o(k)tab(31)t(k)tab(35)w(k)
  92. 1150 next:print tab(19)m$,tab(19)"[212][193][194][204][197] 1: [193]ll rows"
  93. 1160 print tab(19)"with invalid values",tab(19)"have been discarded"
  94. 1170 print tab(19)m$,tab(25)"<[195]> <[208]/[212]> <[209]>":gosub 5000
  95. 1180 :
  96. 1190 rem table 2
  97. 1200 a=1:j=1:if c=0 then 1230
  98. 1210 print d$"[212][193][194][204][197] 2: "r$"[204]  [214]  [198]  [211]  [216]"b$:for k=1to z:print".";:next:print u$
  99. 1220 print"[162]";:goto 1250
  100. 1230 gosub 2990:gosub 3020:print tab(21)u$"/   /   /   /   /"
  101. 1240 gosub 3030:gosub 3040
  102. 1250 k=j-1:forl=-19to19:ifl=w(j)orl=t(j)orl=o(j)orl=n(j)orl=i(j)or l=e then1350
  103. 1260 v=11-3*e-n(j)-l:if v<-19 or v>19 or v=l or v=e then 1350
  104. 1270 if v=w(j) or v=t(j) or v=o(j) or v=n(j) or v=i(j) then 1350
  105. 1280 f=5-e-i(j)-v:if f<-19 or f>19 or f=v or f=l or f=e then 1350
  106. 1290 if f=w(j) or f=t(j) or f=o(j) or f=n(j) or f=i(j) then 1350
  107. 1300 s=7-2*e-n(j)-v:if s<-19 or s>19 or s=f or s=v or s=l or s=e then 1350
  108. 1310 if s=w(j) or s=t(j) or s=o(j) or s=n(j) or s=i(j) then 1350
  109. 1320 x=6-i(j)-s:if x<-19 or x>19 or x=s or x=f or x=v or x=l or x=e then 1350
  110. 1330 if x=w(j) or x=t(j) or x=o(j) or x=n(j) or x=i(j) then 1350
  111. 1340 k=k+1:l(k)=l:v(k)=v:f(k)=f:s(k)=s:x(k)=x
  112. 1350 next:if c=0 then 1390
  113. 1360 gosub 2810:if j<=z then 1220
  114. 1370 if z=0 then 2200
  115. 1380 print d$d$:for i=1 to z:print".";:next:print h$d$d$d$d$d$d$d$d$:goto1600
  116. 1390 if k<j then 1460
  117. 1400 for i=j to k:x$=left$(str$(x(i)),3):if i<>j+19 then 1440
  118. 1410 print tab(20)m$,tab(21)"[205]ore <[195]> <[208]/[212]> <[209]>":gosub 5000
  119. 1420 gosub 2990:gosub 3020:gosub 3030:gosub 3040
  120. 1430 print tab(20)m$,tab(21)"[195]ontinued",tab(20)m$
  121. 1440 print tab(20)l(i)tab(24)v(i)tab(28)f(i)tab(32)s(i)tab(36)x$
  122. 1450 next
  123. 1460 gosub 2810:if z=0 then 2200
  124. 1470 gosub 2930:if j<=z then 1230
  125. 1480 :
  126. 1490 rem table 2 display
  127. 1500 for j=1 to z:if (j-1)/20>int((j-1)/20) then 1520
  128. 1510 gosub 2990:a=j
  129. 1520 gosub 3020:gosub 3130
  130. 1530 if j/20>int(j/20) and j<z then 1560
  131. 1540 b=j:print"-"m$m$,"[197]="e;l$":[212][193][194][204][197] 2:"a"-"b"/"z;tab(28)
  132. 1550 print r$"<[195]><[208]/[212]><[209]>"u$b$:gosub 5000
  133. 1560 next
  134. 1570 :
  135. 1590 rem table 3
  136. 1600 a=0:j=1:if c=0 then 1630
  137. 1610 print"[212][193][194][204][197] 3: "r$"[199]  [200]  [210]  [213]"b$
  138. 1620 print"[162]";:goto 1720
  139. 1630 gosub 2990:gosub 3020:gosub 3130:gosub 3030
  140. 1640 print" 3. [200]+[210] ="3-2*e-t(j):print" 4. [213]+[210] ="4-o(j)-f(j)
  141. 1650 print" 8. [199]+[200] ="8-e-i(j)-t(j):print m$l$" ",,," 8. [200] ="8-e-i(j)-t(j)"- [199]"
  142. 1660 print" 3. [210] ="3-2*e-t(j)"- [200]":print" 4. [213] ="4-o(j)-f(j)"- [210]":print e$l$" "
  143. 1670 print o$"  [199] _ [200] _ [210] _ [213]   ",,,"-19 < = [199] < = +19 "
  144. 1680 print o$"[196]iscard rows with ",,,"forbidden values. ":print g$l$" "
  145. 1690 print h$d$d$d$d$tab(22)r$"[185][185][185] [185][185][185] [185][185][185] [185][185][185]"b$
  146. 1700 print tab(22)o$" [199] "i$" [200] "i$" [210] "i$" [213] "
  147. 1710 print tab(22)r$"[184][184][184] [184][184][184] [184][184][184] [184][184][184]"b$,tab(23)"/   /   /   /"u$
  148. 1720 k=j-1:forg=-19to19:ifg=x(j)org=s(j)org=f(j)org=v(j)org=l(j)or g=e then1800
  149. 1725 if g=w(j) or g=t(j) or g=o(j) or g=n(j) or g=i(j) then 1800
  150. 1730 h=8-e-i(j)-t(j)-g:if h<-19 or h>19 or h=g or h=e then 1800
  151. 1740 if h=x(j) or h=s(j) or h=f(j) or h=v(j) or h=l(j) then 1800
  152. 1745 if h=w(j) or h=t(j) or h=o(j) or h=n(j) or h=i(j) then 1800
  153. 1750 r=3-2*e-t(j)-h:if r<-19 or r>19 or r=h or r=g or r=e then 1800
  154. 1760 if r=x(j) or r=s(j) or r=f(j) or r=v(j) or r=l(j) then 1800
  155. 1765 if r=w(j) or r=t(j) or r=o(j) or r=n(j) or r=i(j) then 1800
  156. 1770 u=4-o(j)-f(j)-r:if u<-19 or u>19 or u=r or u=h or u=g or u=e then 1800
  157. 1780 if u=x(j) or u=s(j) or u=f(j) or u=v(j) or u=l(j) then 1800
  158. 1785 if u=w(j) or u=t(j) or u=o(j) or u=n(j) or u=i(j) then 1800
  159. 1790 k=k+1:g(k)=g:h(k)=h:r(k)=r:u(k)=u
  160. 1800 next:if c=0 then 1830
  161. 1810 gosub 2810:if j<=z then 1620
  162. 1820 goto 1900
  163. 1830 if k<j then 1850
  164. 1840 for i=j to k:print tab(22)g(i)tab(26)h(i)tab(30)r(i)tab(34)u(i):next
  165. 1850 gosub 2810:if z=0 then 2200
  166. 1860 gosub 2930:if j<=z then 1630
  167. 1870 :
  168. 1890 rem solutions
  169. 1900 if z=0 then 2200
  170. 1910 a$="a":j$="j":z$="h":for k=1 to z:if (k-1)/7>int((k-1)/7) then 1980
  171. 1920 t=-1:a=k:print c$d$r$"[185][185][185][185][185][185][185][185]  [185][185][185][185][185][185][185][185][185][185][185][185][185][185][185]  [185][185][185][185][185][185][185][185][185][185][185]"b$,tab(6)
  172. 1930 print o$"  "tab(23)"  "u$,," [197] ="e;tab(10);z;l$" [211]olutions ";
  173. 1940 print tab(27)" [195]hecked [186] ",f$r$"[184][184][184][184][184][184][184][184]  [184][184][184][184][184][184][184][184][184][184][184][184][184][184][184]  [184][184][184][184][184][184][184][184][184][184][184]"b$
  174. 1950 print" [197] =":print" [198] =":print" [199] =":print" [200] =":print" [201] =":print" [204] ="
  175. 1960 print" [206] =":print" [207] =":print" [210] =":print" [211] =":print" [212] =":print" [213] ="
  176. 1970 print" [214] =":print" [215] =":print" [216] =":print m$m$
  177. 1980 t=t+5:print h$d$d$d$d$tab(t)e:print tab(t)f(k):print tab(t)g(k)
  178. 1990 print tab(t)h(k):print tab(t)i(k):print tab(t)l(k):print tab(t)n(k)
  179. 2000 print tab(t)o(k):print tab(t)r(k):print tab(t)s(k):print tab(t)t(k)
  180. 2010 print tab(t)u(k):print tab(t)v(k):print tab(t)w(k):print tab(t)x(k):print
  181. 2020 if o(k)+n(k)+e<>1 or t(k)+w(k)+o(k)<>2 or t(k)+h(k)+r(k)+e+e<>3 then 2090
  182. 2030 if f(k)+o(k)+u(k)+r(k)<>4 or f(k)+i(k)+v(k)+e<>5 then 2090
  183. 2040 if s(k)+i(k)+x(k)<>6 or s(k)+e+v(k)+e+n(k)<>7 then 2090
  184. 2050 if e+i(k)+g(k)+h(k)+t(k)<>8 or n(k)+i(k)+n(k)+e<>9 then 2090
  185. 2060 if t(k)+e+n(k)<>10 or e+l(k)+e+v(k)+e+n(k)<>11 then 2090
  186. 2070 if t(k)+w(k)+e+l(k)+v(k)+e<>12 then 2090
  187. 2080 print tab(t+1)"[186]":goto 2100
  188. 2090 print
  189. 2100 if t<34 and k<z then 2150
  190. 2110 b=k:print m$m$,"[211]olutions"a"-"b;tab(21)"<[195]> <[208]/[212]/"r$"[193]"b$"ll> <[209]>"
  191. 2120 print "<"r$"[200]"b$"> [200]elp";tab(21)"<"r$"[202]"b$"ump [212]o [211]ummary>"
  192. 2130 gosub 5000:if q$="j" then k=z
  193. 2140 if q$="h" then k=a-1:gosub 4610
  194. 2150 next:j$="":z$=""
  195. 2160 :
  196. 2200 rem solution summary
  197. 2210 c(e+20)=z:print c$d$e$:print o$" [211]olution [211]ummary  ":print g$:print n$
  198. 2220 k=0:for j=1 to 13:k=k+c(j)+c(j+13)+c(j+26)
  199. 2230 print"[197] ="j-20;tab(7)r$c(j)b$;:if c(j)=-1 then print l$l$l$" ---";:k=k+1
  200. 2240 printtab(14)"[197] ="j-7;r$c(j+13)b$;:ifc(j+13)=-1thenprintl$l$l$" ---";:k=k+1
  201. 2250 print tab(27)"[197] ="j+6;tab(34)r$c(j+26)b$;:if c(j+26)>-1 then 2270
  202. 2260 print l$l$l$" ---";:k=k+1
  203. 2270 print:next
  204. 2280 print n$,e$e$,s$s$,u$"   [212]otal [206]umber of [211]olutions ="k,f$g$g$
  205. 2290 print "<[195]> [195]ontinue  <[208]/[212]/[193]> [208]rint  <[209]> [209]uit":gosub 5000:a$=""
  206. 2300 poke 53280,15:poke 53281,15
  207. 2310 if c=1 and e<19 then e=e+1:goto 900
  208. 2320 goto 500
  209. 2330 :
  210. 2600 rem deletions
  211. 2610 for i=j to z-1:q=i+1
  212. 2620 i(i)=i(q):n(i)=n(q):o(i)=o(q):t(i)=t(q):w(i)=w(q):if a then 2640
  213. 2630 l(i)=l(q):v(i)=v(q):f(i)=f(q):s(i)=s(q):x(i)=x(q)
  214. 2640 next:return
  215. 2650 :
  216. 2700 rem insertions
  217. 2710 for i=z to j+1 step -1:q=i+k-j
  218. 2720 i(q)=i(i):n(q)=n(i):o(q)=o(i):t(q)=t(i):w(q)=w(i):if a then 2740
  219. 2730 l(q)=l(i):v(q)=v(i):f(q)=f(i):s(q)=s(i):x(q)=x(i)
  220. 2740 next:return
  221. 2750 for i=j+1 to k
  222. 2760 i(i)=i(j):n(i)=n(j):o(i)=o(j):t(i)=t(j):w(i)=w(j):if a then 2780
  223. 2770 l(i)=l(j):v(i)=v(j):f(i)=f(j):s(i)=s(j):x(i)=x(j)
  224. 2780 next:return
  225. 2790 :
  226. 2800 rem shared analysis and print
  227. 2810 b=1:if k=j then j=j+1:return
  228. 2820 if k>j then 2880
  229. 2830 b=0:if j=z then 2850
  230. 2840 gosub 2610
  231. 2850 z=z-1:if z>0 then return
  232. 2860 print:print tab(20)m$d$,tab(26)"[197] ="e,tab(26)"[206]o [211]olution"d$
  233. 2870 print tab(26)"<[195]> <[208]/[212]> <[209]>":gosub 5000:return
  234. 2880 if j=z then 2900
  235. 2890 gosub 2710
  236. 2900 gosub 2750
  237. 2910 z=z+k-j:j=k+1:return
  238. 2920 :
  239. 2930 if b then print tab(20)m$:goto 2960
  240. 2940 print tab(20)d$e$,tab(20)o$" [193]ll rows contain  "
  241. 2950 print tab(20)o$" forbidden values. ",tab(20)f$g$
  242. 2960 if j>z then print tab(23)d$"[206]umber [207]f",tab(23)"[211]uccesses ="z;d$
  243. 2970 print tab(26)"<[195]> <[208]/[212]> <[209]>":gosub 5000:return
  244. 2980 :
  245. 2990 print c$r$"[185][185][185] [185][185][185] [185][185][185] [185][185][185] [185][185][185] [185][185][185] [185][185][185] [185][185][185] [185][185][185] [185][185][185]"b$o$,
  246. 3000 print" [201] "i$" [206] "i$" [207] "i$" [212] "i$" [215] "i$" [204] "i$" [214] "i$" [198] "i$" [211] "i$" [216] "
  247. 3010 print r$"[184][184][184] [184][184][184] [184][184][184] [184][184][184] [184][184][184] [184][184][184] [184][184][184] [184][184][184] [184][184][184] [184][184][184]"b$:return
  248. 3020 print i(j);tab(4)n(j);tab(8)o(j);tab(12)t(j);tab(16)w(j):return
  249. 3030 print e$l$" ",,,tab(16)o$"  "u$,,,"[197]quations  [197] ="e,,,f$g$l$" ":return
  250. 3040 print" 3. [200]+[210] ="3-2*e-t(j):print" 4. [198]+[213]+[210] ="4-o(j)
  251. 3050 print" 5. [198]+[214] ="5-e-i(j):print" 6. [211]+[216] ="6-i(j)
  252. 3060 print" 7. [211]+[214] ="7-2*e-n(j):print" 8. [199]+[200] ="8-e-i(j)-t(j)
  253. 3070 print"11. [204]+[214] ="11-3*e-n(j):print m$l$" ":print"11. [214] ="11-3*e-n(j)"-[204]"
  254. 3080 print" 5. [198] ="5-e-i(j)"-[214]":print" 7. [211] ="7-2*e-n(j)"-[214]"
  255. 3090 print" 6. [216] ="6-i(j)"-[211]"
  256. 3100 print e$l$" ":print o$"[204] _ [214] _ [198] & [211] _ [216] ",,,"-19 < = [204] < = +19 "
  257. 3110 print o$"[196]iscard rows with ",,,"forbidden values. ":print g$l$" "h$d$d$
  258. 3120 return
  259. 3130 x$=left$(str$(x(j)),3)
  260. 3140 print u$tab(20)l(j);tab(24)v(j);tab(28)f(j);tab(32)s(j);tab(36)x$:return
  261. 3150 :
  262. 3990 rem method help screen 1
  263. 4000 poke 53280,7:poke 53281,7:print c$tab(12)"[205]ethod:[200]elp 1(3)"
  264. 4010 print r$"[184][184]"g$g$"[212]he "r$"[195]"b$" key is used to advance the program";
  265. 4020 print"on all screens except the [205][197][212][200][207][196] screen.[193]ctions there";
  266. 4030 print" are initiated by "r$"\ ^ * _"b$". --"m$m$;
  267. 4040 print"<"r$"\"b$"> [212]he [215]ork [211]creens allow you to view"
  268. 4050 print"and print the steps of the solution.","--"m$m$;
  269. 4060 print"<"r$"^"b$"><"r$"*"b$"> [212]he [199]auge [211]creen produces faster"
  270. 4070 print"solutions, showing final results only.  --"m$m$;
  271. 4080 print"<"r$"*"b$"> [211]olve--[193]ll [197]'s automatically assigns";
  272. 4090 print"the next unused [197] for solving after each";
  273. 4100 print"solution screen and summary are cleared.--"m$m$;
  274. 4110 print"<"r$"_"b$"> [193]ssume [211]ummary [196]ata for [197]'s solved"
  275. 4120 print"on earlier runs of the program. <"r$"*"b$"> will";
  276. 4130 print"then not re-solve with those [197] [214]alues.  --"m$m$;
  277. 4140 print"<"r$"+"b$"><"r$"-"b$"> [201]ncrease or [196]ecrease the value of";
  278. 4150 print"[197]. [212]he value showing is used by "r$"\ ^ _"b$".  "r$"[185][185]"e$e$
  279. 4160 print"<[195]> [195]ontinue   <[208]/[212]> [208]rint   <[209]> [209]uit";:gosub 5000
  280. 4170 :
  281. 4180 rem method help screen 2
  282. 4190 poke 53280,7:poke53281,7:print c$" [205]ethod:[200]elp 2.  [215]hy not test them all?"
  283. 4200 print i$e$e$,i$s$s$,i$" [212]he rules permit 39*38*37*...*26*25  ",i$;
  284. 4210 print" permutations of the variable values. ",i$s$s$,i$;
  285. 4220 print"  = 32,876,032,900,000,000,000,000 =  ",i$s$s$,i$;
  286. 4230 print" [195]omputers testing a million of these ",i$;
  287. 4240 print" each second would require more than  ",i$;
  288. 4250 print" a billion years to test them all.    ",i$s$s$f$,i$g$g$d$
  289. 4260 print" [197]quation 12 may be discarded since it"
  290. 4270 print" is derivable from equations 1,2, & 11.",i$m$m$
  291. 4280 print r$" [197]q.2 + [197]q.11 - [197]q.1 _ [197]q.12"b$:print i$m$m$
  292. 4290 print" ([212]+[215]+[207])+([197]+[204]+[197]+[214]+[197]+[206])-([207]+[206]+[197]) = 2+11-1"
  293. 4300 print"  [212]+[215]+[207] + [197]+[204]+[197]+[214]+[197]+[206] - [207]-[206]-[197]  = 12"
  294. 4310 print"  [212]+[215]   + [197]+[204]  +[214]+[197]            = 12",i$m$m$
  295. 4320 print" <[195]> [195]ontinue  <[208]/[212]> [208]rint  <[209]> [209]uit":gosub 5000
  296. 4330 :
  297. 4340 rem method help screen 3
  298. 4350 poke 53280,7:poke 53281,7:print c$"[205]ethod:[200]elp 3 ";:q$=left$(m$,13)
  299. 4360 print r$"([213]se [193]ll [201])"b$" [201]  [206]  [207]  [212]  [215]",q$tab(26)q$
  300. 4370 print" 9. [206]=(9-[197]-[201])/2   "r$"[212]able /"b$"-19 -  -  -  -"
  301. 4380 print" 1. [207]=1-[197]-[206]       "r$"[207]ne  /"b$" -18 -[214]alues  -"
  302. 4390 print"10. [212]=10-[197]-[206]          "r$"/"b$"    . -[198]rom -  -"
  303. 4400 print" 2. [215]=2-[212]-[207]          "r$"/"b$"     . -[197]quations"
  304. 4410 print r$"    [208]ick [207]ne [197]......."b$"[197]"r$"[164][164][164]"b$"+19 -  -  -  - -"m$m$
  305. 4420 print tab(14)r$"([213]se [193]ll [204]) "b$"[204]  [214]  [198]  [211]  [216]","11. [214]=11-3[197]-[206]-[204]"tab(26)q$
  306. 4430 print" 5. [198]=5-[197]-[201]-[214]     "r$"[212]able /"b$"-19 -  -  -  -"
  307. 4440 print" 7. [211]=7-2[197]-[206]-[214]    "r$"[212]wo  /"b$" -18 -[214]alues  -"
  308. 4450 print" 6. [216]=6-[201]-[211]           "r$"/"b$"    . -[198]rom -  -"
  309. 4460 print r$"[204]ine [198]rom"tab(21)"/"b$"     . -[197]quations"
  310. 4470 print r$"[212]able [207]ne.."b$"[197]:[201]:[206]:[207]:[212]:[215]"r$"[164][164][164]"b$"+19 -  -  -  - -"m$m$
  311. 4480 print tab(17)r$"([213]se [193]ll [199]) "b$"[199]  [200]  [210]  [213]"
  312. 4490 print" 8. [200]=8-[197]-[201]-[212]-[199]"tab(29)"----------"
  313. 4500 print" 3. [210]=3-2[197]-[212]-[200]    "r$"[212]able    /"b$"-19 -  -  -"
  314. 4510 print" 4. [213]=4-[207]-[198]-[210]     "r$"[212]hree   /"b$" -18 -[214]alues"
  315. 4520 print tab(25)r$"/    "b$". -[198]rom -"
  316. 4530 print r$"[204]ine [198]rom [212]able [212]wo     /     "b$". -[197]qs. -"
  317. 4540 print r$" ..."b$"[197]:[201]:[206]:[207]:[212]:[215]:[204]:[214]:[198]:[211]:[216]"r$"[164][164][164]"b$"+19 -  -  - -"m$m$
  318. 4550 print"<[195]> [195]ontinue   <[208]/[212]> [208]rint   <[209]> [209]uit";:gosub 5000
  319. 4560 poke 53280,15:poke 53281,15:return
  320. 4570 :
  321. 4600 rem solution help screen
  322. 4610 poke 53280,7:poke 53281,7
  323. 4620 print c$d$r$"[184][184]"g$g$"[212]here are two special commands available";
  324. 4630 print"on the [211]olutions [196]isplay [211]creens:<"r$"[193]"b$"><"r$"[202]"b$">.--"m$m$;
  325. 4640 print"<"r$"[193]"b$"> [208]rint [193]ll of the solutions for the"
  326. 4650 print"current [197] value. ("r$"[193]"b$" is also hot on the"
  327. 4660 print"[211]ummary [211]creen--current [197] value.) "r$"[208]"b$" & "r$"[212]"b$
  328. 4670 print"continue to print the screen contents.  --"m$m$;
  329. 4680 print"<"r$"[202]"b$"> [202]ump. [211]kip the on-screen display of"
  330. 4690 print"solutions. "r$"[195]"b$" continues the normal screen";
  331. 4700 print"display, which includes the "r$"[186]"b$" routine."
  332. 4710 print"("r$"[193]"b$" & "r$"[202]"b$" are the quick way to copy current";
  333. 4720 print"solutions and begin the next solution.) --"m$m$;
  334. 4730 print"[212]he checking routine prints a "r$"[186]"b$" only if"
  335. 4740 print"the values check in all twelve equations";
  336. 4750 print"(lines 2020-2090.) [201]f the program and"
  337. 4760 print"algorithm are error free, all solutions"
  338. 4770 print"produced must check. [212]he "r$"[186]"b$" routine has"
  339. 4780 print"been verified with good and bad data.   "r$"[185][185]"e$e$
  340. 4790 print"<[195]> [195]ontinue   <[208]/[212]> [208]rint   <[209]> [209]uit";
  341. 4800 gosub 5000:poke 53280,15:poke 53281,15:return
  342. 4810 :
  343. 5000 rem check keypress
  344. 5010 get q$:if q$="" then 5010
  345. 5020 if q$="q" then 40000
  346. 5030 if q$="p" or q$="t" or q$=a$ then gosub 9000:goto 5010
  347. 5040 if q$<>"c" and q$<>j$ and q$<>z$ then 5010
  348. 5050 return
  349. 5060 :
  350. 9000 rem printer
  351. 9010 poke 53280,0:poke 53281,0:open1,4,7:close 1:if st<>0 then 9210
  352. 9020 open 1,4,7:if q$="a" then 9110
  353. 9030 t$="":if q$="t" then t$="                                        "
  354. 9040 print#1,t$;:for m=1 to 39:print#1,"[164]";:next:print#1
  355. 9050 for y=0 to 24:print#1,t$;
  356. 9060 for m=0 to 39:p=peek(40*y+m+1024):if p>127 then p=p-128
  357. 9070 if p>95 or p<32 then p=p+64:goto 9090
  358. 9080 if p>63 then p=p+32
  359. 9090 print#1,chr$(p);:next:print#1:next
  360. 9100 print#1,t$;:for m=1 to 39:print#1,"[163]";:next:print#1:goto 9200
  361. 9110 print#1,"       [197]    [198]    [199]    [200]    [201]    [204]    [206]";
  362. 9120 print#1,"    [207]    [210]    [211]    [212]    [213]    [214]    [215]    [216]"
  363. 9130 print#1,"    ";:for m=1 to 15:print#1,"  ---";:next:print#1
  364. 9140 for m=1 to z:x=m:gosub9220:x=e:gosub9220:x=f(m):gosub9220:x=g(m):gosub9220
  365. 9150 x=h(m):gosub9220:x=i(m):gosub9220:x=l(m):gosub9220:x=n(m):gosub9220
  366. 9160 x=o(m):gosub9220:x=r(m):gosub9220:x=s(m):gosub9220:x=t(m):gosub9220
  367. 9170 x=u(m):gosub9220:x=v(m):gosub9220:x=w(m):gosub9220:x=x(m):gosub9220
  368. 9180 print#1:next
  369. 9190 print#1,"    ";:for m=1 to 15:print#1,"  ---";:next:print#1
  370. 9200 close 1
  371. 9210 poke 53280,15:poke 53281,15:return
  372. 9220 print#1,left$(" "+str$(x)+"  ",5);:return
  373. 9230 :
  374. 10000 d=peek(186):n$="b.crypto sol":open15,d,15,"s0:"+n$:close15:saven$,d:end
  375. 40000 poke650,0
  376. 40002 fori=8to29:poke820+i,i:next:ifdv>8anddv<30thenpoke828,dv:poke820+dv,8
  377. 40010 a$="presenter":gosub40030:a$="hello connect":gosub40030
  378. 40020 print"[147]":poke53272,23:poke186,8:poke2048,0:poke44,8:poke43,1:end
  379. 40030 forj=8to29:i=peek(820+j):ifi=14thennext
  380. 40040 close2:open2,i,2:close2:ifstthen40060
  381. 40050 close15:open15,i,15,"r0:"+a$+"="+a$:input#15,er:close15:ifer=63then40070
  382. 40060 next:return
  383. 40070 a$="hello connect":q$=chr$(34):poke646,peek(53281):print"[147]":poke53272,23
  384. 40080 print"[147]p[207]2048,0:p[207]44,8:p[207]43,1:p[207]56,160:p[207]55,0:clr:l[207]"q$a$q$","i
  385. 40090 print"run:":poke631,13:poke632,13:poke198,2:end
  386.